import time
from pynput import mouse

# mouseclass = mouse.Controller()
#
# print(mouseclass.position)
# x,y = mouseclass.position
# mouseclass.move(x,y)
# time.sleep(1)
# print(mouseclass.position)
events = ['event1', 'event2', 'event3', 'event4']

print("=== 使用 while 循环（安全）===")
while events:
    event = events.pop(0)  # 安全地取出并删除第一个元素
    print(f"处理: {event}")
    print(f"剩余: {events}")
    time.sleep(0.1)  # 模拟处理时间

print(f"最终结果: {events}")
print("所有事件都被正确处理！")